﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="QuanLyGiangVien.aspx.cs" Inherits="Admin_QuanLyGiangVien" Title="Quản Lý Giảng Viên" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ MasterType VirtualPath="~/Admin/Admin.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <div class="wrap">
        <h2>
            Quản lý thông tin giảng viên |
            <asp:HyperLink ID="HyperLink2" runat="server" CssClass="node"
            NavigateUrl="~/Admin/ThongTinGiangVien.aspx?action=1" BackColor="#F1F1F2" >Thêm giảng viên</asp:HyperLink>
             |
            <asp:HyperLink ID="HyperLink1" runat="server" CssClass="node"
            NavigateUrl="~/Admin/PhanCongViec.aspx" BackColor="#F1F1F2" >Phân công việc</asp:HyperLink>
        </h2>
    </div>
    <div style="clear: both;">&nbsp;</div>
    <hr />

<div align="center" style="width:100%; border: solid 1px #CCCCCC;padding-top:0px; height:300px;  overflow:auto;">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

     <asp:GridView ID="GridView_GiangVien" runat="server" AutoGenerateColumns="False" 
         AllowPaging="True"  Width="100%" 
         onrowdatabound="GridView1_RowDataBound"  
            DataKeyNames="MsGiangVien" 
            onpageindexchanging="GridView_GiangVien_PageIndexChanging" 
            onrowcommand="GridView_GiangVien_RowCommand" GridLines="None">
         <Columns>
            <asp:TemplateField HeaderText="" >
                <ItemTemplate>
                    <input name="MyRadioButton" type="radio"  style="width:35px;"
                                value='<%# Eval("MsGiangVien") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="STT">   
            <ItemTemplate>   
                <%# Container.DataItemIndex + 1 %>   
            </ItemTemplate>   
            </asp:TemplateField>   
             <asp:BoundField DataField="MsGiangVien" HeaderText="Mã số giảng viên" 
                 ReadOnly="True" SortExpression="MsGiangVien" />
             <asp:BoundField DataField="TenGiangVien" HeaderText="Họ tên giảng viên" 
                 SortExpression="TenGiangVien" />
             <asp:CheckBoxField DataField="GioiTinh" HeaderText="Giới tính" 
                 SortExpression="GioiTinh" />
             <asp:BoundField DataField="NgaySinh" HeaderText="Ngày sinh" 
                 SortExpression="NgaySinh" DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="False">
             <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
             </asp:BoundField>
             <asp:BoundField DataField="DiaChi" HeaderText="Địa chỉ" 
                 SortExpression="DiaChi" />
             <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
             <asp:BoundField DataField="SoDT" HeaderText="Số ĐT" SortExpression="SoDT" />
             <asp:BoundField DataField="HinhAnh" HeaderText="Hình ảnh" 
                 SortExpression="HinhAnh" />
            <asp:HyperLinkField DataNavigateUrlFields="MsGiangVien" 
                 DataNavigateUrlFormatString="./ThongTinGiangVien.aspx?action=2&MSGV={0}" 
                 Text="Sửa"  ControlStyle-BackColor="#F1F1F2" >
                <ControlStyle BackColor="#F1F1F2" CssClass="link1" />
             </asp:HyperLinkField>
            <asp:HyperLinkField DataNavigateUrlFields="MsGiangVien" 
                 DataNavigateUrlFormatString="./PhanCongViec.aspx?MSGV={0}" 
                 Text="Phân công"  ControlStyle-BackColor="#F1F1F2" >
                <ControlStyle BackColor="#F1F1F2" CssClass="link1" />
             </asp:HyperLinkField>

                <asp:TemplateField ShowHeader="False" >
                    <ItemTemplate >
                       <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="false" CommandName="Edit" Text="Edit">
                        <img src="../Images/pencil.png" alt="Edit" style="padding-left:10px; padding-right:10px;">
                            </asp:LinkButton>
                        <ajaxToolkit:ModalPopupExtender BackgroundCssClass="ModalPopupBG" ID="ModalPopupExtender1"
                            runat="server" TargetControlID="lnkEdit" PopupControlID="pnlPerson"
                            OkControlID="btnSavePerson" CancelControlID="btnCancelPerson">
                        </ajaxToolkit:ModalPopupExtender>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="true" 
                            CommandName="MyDelete" ImageUrl="../Images/cross.png" 
                            Text="Delete" style="padding-left:10px; padding-right:10px;"/>
                        <ajaxToolkit:ModalPopupExtender BackgroundCssClass="modalBackground" ID="lnkDelete_ModalPopupExtender"
                            runat="server" TargetControlID="ImageButton2" PopupControlID="DivDeleteConfirmation"
                            OkControlID="ButtonDeleleOkay" CancelControlID="ButtonDeleteCancel">
                        </ajaxToolkit:ModalPopupExtender>
                        
                        
                        <ajaxToolkit:ConfirmButtonExtender ID="lnkDelete_ConfirmButtonExtender" runat="server" Enabled="True"
                            TargetControlID="ImageButton2" DisplayModalPopupID="lnkDelete_ModalPopupExtender">
                        </ajaxToolkit:ConfirmButtonExtender> 
                    </ItemTemplate>

                </asp:TemplateField>

         </Columns>
         <PagerTemplate>
            <asp:TextBox ID="txtSlide" runat="server" Text='<%# GridView_GiangVien.PageIndex + 1 %>' AutoPostBack="true"  />
            <cc1:SliderExtender ID="ajaxSlider" runat="server" TargetControlID="txtSlide" Orientation="Horizontal" />
            <asp:Label ID="lblPage" runat="server" 
                Text='<%# "Bạn đang xem trang <b>" + (GridView_GiangVien.PageIndex + 1) + "</b> trong tổng số <b>" 
                 + GridView_GiangVien.PageCount +"</b> trang" %>' 
                style="color: #FF6600" />
        </PagerTemplate>
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
            <AlternatingRowStyle BackColor="White" />

     </asp:GridView>
     
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
            ContextTypeName="DataClassesDataContext" TableName="tbl_GIANGVIENs">
        </asp:LinqDataSource>
         </ContentTemplate>
    </asp:UpdatePanel>
</div>

<%-- Bảng thông báo xóa dữ liệu--%>
        <asp:Panel runat="server" ID="DivDeleteConfirmation" Style="display: none;" class="modalBox">
        <div>
            <div class="popup_Titlebar" id="PopupHeader">
                <div class="TitlebarLeft">
                    Xóa dữ liệu</div>
                <div class="TitlebarRight" onclick="$get('ButtonDeleteCancel').click();">
                </div>
            </div>
            <div class="popup_Body">
                <p>Bạn có chắc chắn muốn xóa ? </p>
            </div>
            <div class="popup_Buttons">
                <input id="ButtonDeleleOkay" value="Okay" type="button" />
                <input id="ButtonDeleteCancel" value="Cancel" type="button" />
            </div>
        </div>
        </asp:Panel>
    
<%--Bảng thông tin sinh viên --%>

        <asp:Panel ID="pnlPerson" runat="server" class="modalBox" Style="display:none ;"  >
            <div>
                <div class="popup_Titlebar" >
                    <div class="TitlebarLeft">
                        Thông tin sinh viên</div>
                    <div class="TitlebarRight" onclick="$get('btnCancelPerson').click();">
                    </div>
                </div>
            </div>
		    <asp:HiddenField ID="hidPersonEditIndex" runat="server" Value="-1"   />

            <table >
                <tr style="border: solid 1px #CCCCCC;">
                    <td style="width: 100px">Mã số học viên</td>
                    <td style="width: 105px">
                        <asp:TextBox ID="txtMSSV" runat="server" 
                            Width="237px"></asp:TextBox></td>
                    <td style="width: 100px">Lớp</td>
                    <td style="width: 105px"><asp:TextBox ID="txtLop" runat="server" ></asp:TextBox></td>
                </tr>
                <tr>
                    <td style="width: 100px">Họ tên</td>
                    <td style="width: 105px"><asp:TextBox ID="txtHoTenSV" runat="server" 
                            Width="234px"  ></asp:TextBox></td>
                    <td style="width: 100px">Email</td>
                    <td style="width: 105px"><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td style="width: 100px">Giới tính</td>
                    <td style="width: 105px"><asp:DropDownList ID="ddlGioiTinh" runat="server" 
                            Width="85px">
                        <asp:ListItem Value="True">Nam</asp:ListItem><asp:ListItem Value="Fasle">Nữ</asp:ListItem></asp:DropDownList></td>
                    <td style="width: 100px">Số ĐT</td>
                    <td style="width: 105px"><asp:TextBox ID="txtSoDT" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td style="width: 100px">Ngày sinh</td>
                    <td style="width: 105px">
                        <div style="position:relative;">
                        <asp:TextBox ID="txtNgaySinh" runat="server"></asp:TextBox>
                        <asp:ImageButton ID="Image2" runat="server" ImageUrl="~/Images/Calendar.png" />   
                            <ajaxToolkit:CalendarExtender id="CalendarExtender1" runat="server" PopupButtonID="Image2"
                            TargetControlID="txtNgaySinh" Format="MM/dd/yyyy" onclienthidden="calHidden()" 
                                onclientshown="calShown()" >
                            </ajaxToolkit:CalendarExtender>
                        </div>


                    </td>
                    <td colspan="3" rowspan="3" style="text-align: center"> 
                        <img  alt="" src="../Images/silhouette_default.gif" 
                            style="border-style: solid; border-width: 1px" />       
                    </td>
                </tr>
                <tr>
                    <td style="width: 100px">Địa chỉ</td>
                    <td style="width: 105px">
                        <asp:TextBox ID="txtDiaChi" runat="server" 
                            TextMode="MultiLine"></asp:TextBox></td>
                </tr>
                <tr>
                <td style="width: 100px; height: 21px">
                    Hình ảnh</td>
                <td style="width: 105px" >
                    <asp:FileUpload ID="FileUpload1" runat="server" Width="105px" />
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="FileUpload1" ErrorMessage="*" ValidationExpression= "^([0-9a-zA-Z_\-~ :\\])+(.jpg|.JPG|.jpeg|.JPEG|.bmp|.BMP|.gif|.GIF|.png|.PNG)$"> </asp:RegularExpressionValidator> 
            </td>
            </tr>
            </table>
        
		    <div class="popup_Buttons">
			    <asp:Button ID="btnSavePerson" runat="server" Text="Save"  CausesValidation="true" />
			    <asp:Button ID="btnCancelPerson" runat="server" Text="Cancel" CausesValidation="true" />
		    </div>
	    </asp:Panel>  
	          
</asp:Content>

